package com.honey.mybatis.generator.dao;

import com.honey.compilation.java.AbstractJavaCompilation;
import com.honey.compilation.java.Field;
import com.honey.compilation.java.Method;
import com.honey.core.compiler.CompilationException;
import com.honey.core.dbmapping.introspect.IntrospectSchema;
import com.honey.core.dbmapping.introspect.IntrospectSchemaColumn;
import com.honey.mybatis.generator.AbstractProduceJavaCompilation;
import com.honey.mybatis.generator.MybatisPlugin;
import com.honey.mybatis.generator.dao.method.CountMethod;
import com.honey.mybatis.generator.dao.method.DeleteByDynamicMethod;
import com.honey.mybatis.generator.dao.method.DeleteByPrimaryKeyMethod;
import com.honey.mybatis.generator.dao.method.ExistsMethod;
import com.honey.mybatis.generator.dao.method.InsertMethod;
import com.honey.mybatis.generator.dao.method.InsertSelectiveMethod;
import com.honey.mybatis.generator.dao.method.SaveMethod;
import com.honey.mybatis.generator.dao.method.SelectAllMethod;
import com.honey.mybatis.generator.dao.method.SelectByDynamicMethod;
import com.honey.mybatis.generator.dao.method.SelectByPrimaryKeyMethod;
import com.honey.mybatis.generator.dao.method.SelectOneByDynamicMethod;
import com.honey.mybatis.generator.dao.method.UpdateByDynamicMethod;
import com.honey.mybatis.generator.dao.method.UpdateByDynamicSelectiveMethod;
import com.honey.mybatis.generator.dao.method.UpdateByPrimaryKeyMethod;
import com.honey.mybatis.generator.dao.method.UpdateByPrimaryKeySelectiveMethod;

public class ProduceBaseDaoInterface extends AbstractProduceJavaCompilation {
	
	public ProduceBaseDaoInterface(MybatisPlugin mybatisPlugin,
			IntrospectSchema introspectSchema,
			IntrospectSchemaColumn introspectSchemaColumn) {
		super(mybatisPlugin, introspectSchema, introspectSchemaColumn);
	}
	
	private AbstractJavaCompilation abstractJavaCompilation ;
	
	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractProduceJavaCompilation#produceCompilation()
	 */
	@Override
	public AbstractJavaCompilation produceCompilation() throws CompilationException {
		abstractJavaCompilation = new BaseDaoInterface(mybatisPlugin, introspectSchema, introspectSchemaColumn).createJavaCompilation();
		return abstractJavaCompilation;
	}

	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractProduceJavaCompilation#produceFields()
	 */
	@Override
	public Field[] produceFields() throws CompilationException {
		
		return null;
	}

	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractProduceJavaCompilation#produceMethods()
	 */
	@Override
	public Method[] produceMethods() throws CompilationException {
		Method[] answer = new Method[]{
				new CountMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod() ,
				new CountMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true).createMethod(),
				
				new ExistsMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod() ,
				new ExistsMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true).createMethod(),
				
				new SelectByPrimaryKeyMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod() ,
				new SelectByPrimaryKeyMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true).createMethod(),
			
				new SelectAllMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod(),
				new SelectAllMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,false,true).createMethod(),
				new SelectAllMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true,false).createMethod(),
				new SelectAllMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true,true).createMethod(),
				
				new SelectByDynamicMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod(),
				new SelectByDynamicMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,false,true).createMethod(),
				new SelectByDynamicMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true,false).createMethod(),
				new SelectByDynamicMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true,true).createMethod(),
				
				new SelectOneByDynamicMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod(),
				new SelectOneByDynamicMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true).createMethod(),
				
				new DeleteByDynamicMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod(),
				new DeleteByDynamicMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true).createMethod(),
				
				new DeleteByPrimaryKeyMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod(),
				new DeleteByPrimaryKeyMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true).createMethod(),

				new InsertMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod(),
				new InsertMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true).createMethod(),
				
				new InsertSelectiveMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod(),
				new InsertSelectiveMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true).createMethod(),

				new SaveMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod(),
				new SaveMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true).createMethod(),
				
				new UpdateByPrimaryKeyMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod(),
				new UpdateByPrimaryKeyMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true).createMethod(),

				new UpdateByPrimaryKeySelectiveMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod(),
				new UpdateByPrimaryKeySelectiveMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true).createMethod(),
				
				new UpdateByDynamicSelectiveMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod(),
				new UpdateByDynamicSelectiveMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true).createMethod(),
				
				new UpdateByDynamicMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn).createMethod(),
				new UpdateByDynamicMethod(abstractJavaCompilation, mybatisPlugin, introspectSchema, introspectSchemaColumn,true).createMethod(),
//				
				
				
		};
		return answer;
	}
	
	/**
	 * @return the abstractJavaCompilation
	 */
	public final AbstractJavaCompilation getAbstractJavaCompilation() {
		return abstractJavaCompilation;
	}
	
}
